import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import PostList from '@/components/PostList'
import Article from '@/components/Article'
import SideBar from '@/components/SideBar'
import UserInfo from '@/components/UserInfo'
import VueBasic from '@/components/VueBasic'

Vue.use(Router)

export default new Router({
  mode: 'history',  // 去掉url中的#
  routes: [
    {
      path: '/',
      name: 'root',
      components: {
        main:PostList
      }
    },
    {
      path:'/topic/:id&auther=:name',
      name:'post_content',
      components:{
        main:Article,
        sidebar:SideBar
      },
    },
    {
      path:'/user/:name',
      name:'user_info',
      components:{
        main:UserInfo,
      }
    },
    {
      path: '/hello',
      name: 'hello_world',
      components: {
        main: HelloWorld
      }
    },
    {
      path: '/vuebasic',
      name: 'vue_basic',
      components: {
        main: VueBasic
      }
    }
  ]
})
